/**
 * 可以在非页面，js代码中页面跳转
 * -------------------------
 * 例如: NavigationUtil.push('profile', params)
 */
import { CommonActions } from '@react-navigation/native'
import { Navigator } from '../../index'

export default {
  push(routeName = 'home', params = {}) {
    Navigator &&
      Navigator.dispatch(
        CommonActions.navigate({
          routeName,
          params,
        })
      )
  },
  reset(routeName = 'home', index = 0) {
    // 这个是否有问题，待确认
    Navigator &&
      Navigator.dispatch(
        CommonActions.reset({
          index,
          actions: [CommonActions.navigate({ routeName })],
        })
      )
  },

  resetLastPage: function () {},

  resetLastPageAndHref: function () {},
}
